﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThermalEquipmentDesign.Model.CoolerWet;
using System.Windows;
using System.Windows.Input;
using ThermalEquipmentDesign.Reference_Path;
using ThermalEquipmentDesign.Reference_Path.Evaporator;


namespace ThermalEquipmentDesign.ViewModel
{
    public class CoolerWetViewModel : ObservableObject
    {
        // Declare fields for binding
        #region fields for binding
        private CoolerWet ocoolerwet = new CoolerWet();
        private CoolerWetModel coolerwetmodel;
        private CoolerWetResult ocoolerwetresult = new CoolerWetResult();
        private ICommand calculate;
        private String stooltip = "Press F1 for Help";
        #endregion

        // Create properties for binding
        #region properties for binding
        public String sTooltip
        {
            get { return stooltip; }
            set { stooltip = value; }
        }

        public CoolerWet oCoolerWet
        {
            get
            {
                return ocoolerwet;
            }
            set
            {
                if (value != ocoolerwet)
                {
                    ocoolerwet = value;
                    OnPropertyChanged("oCoolerWet");
                }
            }
        }
        public CoolerWetModel CoolerWetModel
        {
            get
            {
                return coolerwetmodel;
            }
            set
            {
                if (value != coolerwetmodel)
                {
                    coolerwetmodel = value;
                    OnPropertyChanged("CoolerWetModel");
                }
            }
        }
        public CoolerWetResult oCoolerWetResult
        {
            get
            {
                return ocoolerwetresult;
            }
            set
            {
                if (value != ocoolerwetresult)
                {
                    ocoolerwetresult = value;
                    OnPropertyChanged("oCoolerWetResult");
                }
            }
        }
        public ICommand Calculate
        {
            get
            {
                if (calculate == null)
                {
                    calculate = new RelayCommand(
                        param => ImplementCalculation()
                    );
                }
                return calculate;
            }
        }
        #endregion

        /// <summary>
        /// Calculate design parameters for Cooler Wet
        /// </summary>
        public void ImplementCalculation()
        {
            CoolerWetModel cwm = new CoolerWetModel();
            oCoolerWetResult = cwm.ImplementCalculation(oCoolerWet);
        }
        //  Load Reference for the helping 
        public void LoadReference(string sIndex)
        {
            System.Windows.Forms.Help.ShowHelp(null, ReferencePath.ReferenceFile, System.Windows.Forms.HelpNavigator.Index, CoolerWetReference.ResourceManager.GetString(sIndex));
        }
    }
}
